package com.bdqn;


import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class Demo1 {
    private static JedisPool jedisPool;

    static {
        JedisPoolConfig config=new JedisPoolConfig();
        config.setMaxTotal(50);
        config.setMaxIdle(10);
        config.setMinIdle(7);
        config.setMaxWaitMillis(1000);
        config.setTestOnBorrow(true);

        jedisPool = new JedisPool(
                config,
                "192.168.1.101",
                6379,
                10000,
                "123456",
                0
        );
    }
    public void destroy(){
        if (!(jedisPool==null)||jedisPool.isClosed()) {
            jedisPool.close();
        }
    }
}
